Skip to content

Comments

Adding Trap Examples for DoraHack AVS Hackathon#11

Open
keisukefunatsu wants to merge 15 commits intodrosera-network:mainfrom
keisukefunatsu:more-sandbox-examples
Open

Adding Trap Examples for DoraHack AVS Hackathon#11
keisukefunatsu wants to merge 15 commits intodrosera-network:mainfrom
keisukefunatsu:more-sandbox-examples

Conversation

@keisukefunatsu
Copy link

@keisukefunatsu keisukefunatsu commented Jul 20, 2024

Traps

Access Control List Trap

Role:

Monitors and detects unauthorized changes to the list of addresses with specific roles or permissions in a smart contract, such as minters or admins. Helps prevent unauthorized access and potential exploits.

Total Supply Trap

Role:

Monitors the total supply of a token to detect abnormal increases that could indicate unauthorized minting. Helps prevent inflationary attacks by flagging excessive and unauthorized token issuance.

Test & Demo

forge test -vv
Ran 1 test for test/TokenAccessControlTrap.t.sol:TokenAccessControlTrapTest
[PASS] test_TokenAccessControlTrap() (gas: 680592)
Logs:
  oldListLength:  1
  newListLength:  1
  No change.
  oldListLength:  1
  newListLength:  2
  Address length mismatch detected!
  oldListLength:  2
  newListLength:  2
  Address mismatch detected!

Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 7.01ms (1.46ms CPU time)

Ran 2 test suites in 476.79ms (13.57ms CPU time): 5 tests passed, 0 failed, 0 skipped (5 total tests)
Ran 1 test for test/TokenSupply.t.sol:TokenSupplyTrapTest
[PASS] test_TokenSupplyTrap() (gas: 389063)
Logs:
  No change.
  currentSupply increased by more than allowedIncreasePercentage:  1100000000000000000000

Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 6.58ms (1.17ms CPU time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant